package com.yunji.cabinet.dao.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yunji.cabinet.dao.IUpgradeFileLogDao;
import com.yunji.cabinet.domain.UpgradeFileLogDO;
import com.yunji.cabinet.mapper.UpgradeFileLogMapper;
import com.yunji.cabinet.params.CabinetVersionLogParam;
import com.yunji.common.base.BaseDaoImpl;
import com.yunji.common.utils.bean.BeanUtils;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class UpgradeFileLogDaoImpl extends BaseDaoImpl<UpgradeFileLogMapper, UpgradeFileLogDO> implements IUpgradeFileLogDao {
    @Override
    public List<UpgradeFileLogDO> search(CabinetVersionLogParam param) {
        return list(new LambdaQueryWrapper<UpgradeFileLogDO>()
                .eq(BeanUtils.isNotNull(param.getLogId()), UpgradeFileLogDO::getLogId, param.getLogId())
                .eq(BeanUtils.isNotNull(param.getFileId()), UpgradeFileLogDO::getFileId, param.getFileId())
                .eq(BeanUtils.isNotNull(param.getContainerId()), UpgradeFileLogDO::getContainerId, param.getContainerId()));
    }
}
